import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_swiper_null_safety/flutter_swiper_null_safety.dart';
import 'package:bilibili/core/extension/int_extension.dart';
class HomeBanner {

  static final List<String> imageUrl = [
    "https://i0.hdslb.com/bfs/feed-admin/189225d19ebfc0bc43345cf5e7944eaf8e8f5b13.png@880w_388h_1c_95q",
    "https://i0.hdslb.com/bfs/feed-admin/35a9e380f933e84a1200754c04525e4b888b0c45.jpg@880w_388h_1c_95q",
    "https://i0.hdslb.com/bfs/feed-admin/1a813343c1e9fb4a1ef41baeeb49967a544de41e.jpg@880w_388h_1c_95q"
  ];
  static final List<String> imageText = [
    "正在直播LPL季后赛：LNG vs EDG！",
    "真相大白！大会员抢先看>>",
    "20万奖金池，一起投稿全民娱乐家！"
  ];
  static final List<String> imageInfo = [
    "https://live.bilibili.com/6",
    "https://www.bilibili.com/bangumi/play/ss38938",
    "https://www.bilibili.com/read/cv12841880"
  ];


  static Widget buildHomeBanner(BuildContext context) {
    return Container(
      height: 350.px,
      padding: EdgeInsets.all(10.px),
      child: Swiper(
        itemCount: 3,
        itemBuilder: (context, index) => Stack(children: [
          ClipRRect(
              borderRadius: BorderRadius.circular(8.px),
              child: Image.network(
                imageUrl[index],
                height: 350.px,
                fit: BoxFit.fitHeight,
              )),
          Positioned(
            bottom: 10.px,
            left: 10.px,
            child: Text(imageText[index], style: Theme.of(context).textTheme.headline2!.copyWith(
              color: Colors.white
            ),),
          )
        ]),
        autoplay: true,
        pagination: buildSwiperPagination(),
      ),
    );

  }

  static buildSwiperPagination() {
    return SwiperPagination(
      alignment: Alignment.bottomRight,
      margin: EdgeInsets.only(right: 10.px),
      builder: DotSwiperPaginationBuilder(
        size: 10.px,
        color: Colors.grey,
        activeColor: Colors.white,
        activeSize: 10.px
      )
    );
  }

}